package com.centerm.common.constant.enums.project;

import com.centerm.common.constant.StatusCode;

/**
 * @ClassName: enum ProjectStatus
 * @Description: 项目状态选项
 * @author lk
 * @date 2017年7月21日
 */
public enum ProjectStatus implements StatusCode {
    
    DONE_BASEINFO(-2, "未创建里程碑"),
    DONE_GENARAL_ACTIVITY(-1, "未创建全局活动"),
    WAITING(0, "待启动"),
    RUNNING(1, "执行中"),
    FINISH(2, "完结");

    private Integer code;
    private String description;
    
    private ProjectStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getDescription() {
        return this.description;
    }

    public static ProjectStatus getByCode(Integer code) {
        for(ProjectStatus status : ProjectStatus.values()) {
            if(status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }


    public static String getDescriptionByCode(Integer code) {
        for(ProjectStatus status : ProjectStatus.values()) {
            if(status.getCode().equals(code)) {
                return status.getDescription();
            }
        }
        return null;
    }
}
